//
// Created by win10 on 24-12-13.
//

#include <stdio.h>


typedef struct {
    int index;
    int count;
} SearchResult;

SearchResult Search(int a[], int n, int key);

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    int x;
    scanf("%d", &x);

    SearchResult result = Search(a, n, x);

    printf("%d\n%d\n", result.index, result.count);

    return 0;
}


SearchResult Search(int a[], int n, int key) {
    int low = 0, high = n - 1, mid;
    int count = 0;
    SearchResult result;
    while (low <= high) {
        mid = (low + high) / 2;
        count++;
        if (a[mid] == key) {
            result.index = mid;
            result.count = count;
            return result;
        } else if (a[mid] > key) {
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }
    result.index = -1;
    result.count = count;
    return result;
}
